Subject: v02i034: roldx - Rolodex program v2.0, Part01/01
Newsgroups: comp.sources.hp48
Followup-To: comp.sys.hp48
Approved: spell@seq.uncwil.edu
Checksum: 658072737 (verify with brik -cv)
Submitted-by: Jim Weisbin <73457.3462@CompuServe.COM>
Posting-number: Volume 2, Issue 34
Archive-name: roldx/part01
BEGIN_DOC roldx.doc
Yet another rolodex program for the HP48. After sampling
the various rolodex-type programs out there, I decided I
needed to write my own. This one is written entirely in
user code, so it can be easily modified. It is not as fast
as some of the PDL and ML versions, but it mostly does what
I expect from a rolodex program where some of the others
fall short. PICT is not used, which greatly simplified the
programming effort. The database form is "free form" in the
sense that you can store anything you like on any line as
long as you have at least seven items in each list (only 7
will be displayed). The 48 can display 7 lines of text
quickly with a minimum of fuss and I find this to be
adequate room to store name, address, phone, fax, and email
data.
The program is distributed as a directory. Press ROLDX to
start. Depending on the value of flag 34 (see below), you
will either see a screen with all 7 lines of the current
item, or a screen containing 7 items, each being one line
from each of 7 items starting from the current. You will be
presented with a menu as follows:
FIND FIND text prompted for. If one character only,
only the 1st character of 1st or 2nd word (see
flag 32 below) is checked for a match. If more
than one character, a match is sought in any
position. Only the line number set by the var
rdLINE is searched.
EDIT the usual - all 7 lines must be edited, RETURN
leaves each unchanged. An empty string is ok.
ADD add an item _after_ the current item.
DEL delete the current item (you can't delete 1 of
1 though).
->STK put the current item on the stack.
STK-> insert an item from the stack. (Must be a list with
at least 7 items).
In addition to the menu keys above, the following key-
presses are supported:
right-arrow, down-arrow, NEXT increment pointer
up-arrow, left arrow, PREV decrement pointer
left-shift right-arrow & down-arrow incr pointer by 7
left-shift left-arrow & up-arrow decr pointer by 7
right-shift right-arrow & down-arrow go to last
right-shift left-arrow & up-arrow go to first (top)
ENTER enter STATUS mode
(change settings)
right-shift OFF OFF (pause program)
shift-PRINT print current item
There is no sorting provided, but you can use .->STK, STK->,
and DEL to move things around. (If you have Donnelly's Toolkit library, you can use LSORT - see below). The data format makes it fairly easy to transfer data to a PC and edit it there.
The following global variables must be present in the
current directory, and are provided with the listing:
rdNAME a global containing another global which points
to the roldx data list. For example, if the name
of your data list is LIST1, then 'rdNAME' should
contain the global 'LIST1', *not* the list
itself! The format of the data list is a list of
lists, each inner list containing at least 7 items, which can be empty strings, but must be present. The data format is the same as the iNB "Notebook" program which was posted to the net sometime ago (my
complements to Poul-Henning Kamp). The program will
not create a new list if one is not present, so you
should modify the one I have provided, called LIST1.
The data list must be in the Roldx directory!!!
rdSIZ the number of entries (lists) in the data list.
rdPOS number of the current item to display.
rdLINE number of the line to search on, and the number of
the line which gets displayed when displaying only
the headings (flag 34 set).
rdTXT the last text sought by the FIND command (can be
a null string).
The settings of user flags 32-35 are as follows (use the
ENTER key to enter status mode and change the settings):
Flag 32 if clear, and rdTEXT is only one character,
(as set by the FIND command), the program will
attempt to match the first character of the 1st
word of the line to search on (rdLINE). In other
words, clear flag 32 if you put surnames first. If
you put surnames last, then set flag 32, and
the program will attempt to match the 1st
character of the 2nd word of the line to search.
The words are assumed to be separated by a
space. If no spaces are present, then the action
is the same as if flag 32 is clear. Note that, if
flag 32 is set, and there is either a trailing space
or more than one space after the first word (and
no other words), the program will attempt to match
a space. In other words, avoid trailing spaces!!!
Flag 33 if clear, the FIND command searches from the
current position in the list, if set, it
searches from the beginning, which can be very
slow for large databases. Note that only the
line number in rdLINE is searched (searching
all lines would be too slow - perhaps a future
PDL version will overcome this).
Flag 34 if clear, display all 7 lines of each item, if
set, display only one line of each item, for a
total of seven items on each screen. With flag
34 set, the line diplayed for each item is the
value of rdLINE. When flag 34 is set, using
left-shift-arrows will scroll ahead or back by
exactly 7 items (one full screen holds 7 lines).
Flag 35 a temporary flag used by FIND to signal a match.
In STATUS mode, there is a HELP key. The program HELP will
also work when outside of the ROLDX program.
Miscellaneous notes:
Some of the routines are appropriate for general use. These
are as follows:
bell an error bell - edit to anything you want, as
long as it can be evaluated.
Ltrim trim leading spaces from a string. Similar to
Donnelly's LTRIM, but doesn't remove tabs.
Can be replaced by Donnelly's LTRIM for more
speed.
split split the <list in level 2> at the item
<number in level 1>. Equivalent to Donnely's
SPLIT SWAP.
LDEL delete the item <number in level 1> from the
<list in level 2> resulting in a new list minus
that item.
UPcase change case of characters between "a" and "z" to
uppercase. Replacing this with Donnelly's UCASE
will speed up FIND by at least 20%. Or, use the
following ML routine, which was posted to the net
(my apologies to the author, whose name I've lost):